package com.witframework.web.tag;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.BodyTagSupport;
/**
 * <rem:comment execute="true">
   ...
    code will be executed, but without any output
   <%
    String s="12345";
    pageContext.setAttribute("s",s,pageContext.PAGE_SCOPE);
    out.println(s);
   %>
   ...
</rem:comment>
Object is:<%=pageContext.getAttribute("s",pageContext.PAGE_SCOPE)%> 
 * @author wuxinyang
 * Aug 20, 2009 5:38:44 PM
 *
 */
public class CommentTag extends BodyTagSupport {
	private boolean execute = false;
	private boolean cond = true;

	public void setCond(boolean paramBoolean) {
		this.cond = paramBoolean;
	}

	public boolean getCond() {
		return this.cond;
	}

	public boolean getExecute() {
		return this.execute;
	}

	public void setExecute(boolean paramBoolean) {
		this.execute = paramBoolean;
	}

	public int doStartTag() throws JspException {
		if (!(this.execute))
			return 0;
		if (!(this.cond))
			return 1;
		return 2;
	}

	public int doAfterBody() throws JspException {
		return 0;
	}

	public int doEndTag() throws JspException {
		dropData();
		return 6;
	}

	public void release() {
		dropData();
	}

	private void dropData() {
		this.execute = false;
		this.cond = true;
	}
}
